<?php

namespace App\Kuafu\Shop\Controller\Pos;

use App\Kuafu\Base\Controller\BaseController;
use App\Kuafu\Shop\Service\ShopPosConfigService;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;

class ShopPosConfigController extends BaseController
{
    /**
     * @param Request $request
     * @param $shopId
     * @return JsonResponse
     */
    public function info(Request $request): JsonResponse
    {
        $shopId = (int)$request->header('shopId');
        return $this->success(ShopPosConfigService::info($shopId));
    }


    /**
     * 修改收银机配置
     */
    public function update(Request $request): JsonResponse
    {
        $params = $request->all();
        $shopId = (int)$request->header('shopId');
        ShopPosConfigService::update($shopId, $params);

        return $this->success();
    }
}